package com.ccp.dev.workflow.model;

import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;

/**
 * ClassDescribe:
 * 对象功能：流程节点邮件 model对象
 * @author :wangcheng
 * Date: 2019-07-17
 */
@XmlRootElement(name = "bpmNodeMessage")
@XmlAccessorType(XmlAccessType.NONE)
public class BpmNodeMessage extends BaseModel<BpmNodeMessage> implements Cloneable
{
    private static final long serialVersionUID = 1L;

    public static final  short MESSAGE_TYPE_MAIL			= 1;
    public static final  short MESSAGE_TYPE_INNER			= 2;
    public static final  short MESSAGE_TYPE_SMS			    = 3;

    /**
     * id
     */
    @XmlAttribute
    protected String id;
    /**
     * 流程定义ID
     */
    @XmlAttribute
    protected String procDefId;
    /**
     * 流程节点ID
     */
    @XmlAttribute
    protected String nodeId;

    /**
     * 消息接收人类型
     */
    @XmlAttribute
    protected Short messageType;
    /**
     * 消息主题
     */
    @XmlAttribute
    protected String subject;
    /**
     * 消息模板
     */
    @XmlAttribute
    protected String template;
    /**
     * 确认发送 1：发送 ,0 不发送
     */
    protected Short isSend=0;

    private List<BpmUserCondition> userConditions = new ArrayList<BpmUserCondition>();

    public Short getIsSend() {
        return isSend;
    }

    public void setIsSend(Short isSend) {
        this.isSend = isSend;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    /**
     * 返回 id
     * @return
     */
    public String getId()
    {
        return id;
    }


    public String getProcDefId() {
        return procDefId;
    }

    public void setProcDefId(String procDefId) {
        this.procDefId = procDefId;
    }

    public void setNodeId(String nodeId)
    {
        this.nodeId = nodeId;
    }
    /**
     * 返回 流程节点ID
     * @return
     */
    public String getNodeId()
    {
        return nodeId;
    }


    public Short getMessageType() {
        return messageType;
    }
    public void setMessageType(Short messageType) {
        this.messageType = messageType;
    }

    public String getSubject() {
        return subject;
    }
    public void setSubject(String subject) {
        this.subject = subject;
    }
    public String getTemplate() {
        return template;
    }
    public void setTemplate(String template) {
        this.template = template;
    }



    public List<BpmUserCondition> getUserConditions() {
        return userConditions;
    }
    public void setUserConditions(List<BpmUserCondition> userConditions) {
        this.userConditions = userConditions;
    }
    /**
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        if (!(object instanceof BpmNodeMessage))
        {
            return false;
        }
        BpmNodeMessage rhs = (BpmNodeMessage) object;
        return new EqualsBuilder()
                .append(this.id, rhs.id)
                .append(this.procDefId, rhs.procDefId)
                .append(this.nodeId, rhs.nodeId)
                .isEquals();
    }

    /**
     * @see Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.id)
                .append(this.procDefId)
                .append(this.nodeId)
                .toHashCode();
    }

    /**
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
                .append("id", this.id)
                .append("actDefId", this.procDefId)
                .append("nodeId", this.nodeId)
                .toString();
    }

    @Override
    public Object clone()
    {
        BpmNodeMessage obj=null;
        try{
            obj=(BpmNodeMessage)super.clone();
        }catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return obj;
    }


}
